/*
2021-8-3
https://leetcode-cn.com/problems/minimum-garden-perimeter-to-collect-enough-apples/
*/
class Solution {
public:
    long long minimumPerimeter(long long neededApples) {
        long long res=1;
        long long cnt=0;
        for(;;res++)
        {
            cnt+=12*res*res;
            if(cnt>=neededApples) break;
        }
        return res*8;
    }
};
